<?php
	class M_enrolled_subjects extends CI_Model {
	
		function assign_enrollee_subjects($subj_data){
			$this->db->insert_batch('enrolled_subjects', $subj_data);
			return $this->db->affected_rows() >= 1 ? TRUE : FALSE;
		}
		
		
		function get_enrollee_enrolled_subjects($enrollment_id){
			$query = "SELECT subj_code, subj_desc, enrolled_subjects_id FROM enrolled_subjects AS es LEFT JOIN subjects ON es.subj_id = subjects.subj_id WHERE es.enrollment_id = '$enrollment_id'";
			$q = $this->db->query($query);
			return $q->num_rows() >= 1 ? $q->result() : FALSE;
		}
		
		function remove_subject($e_subj_id){
			$this->db->where('enrolled_subjects_id', $e_subj_id)->delete('enrolled_subjects');
			return $this->db->affected_rows() >= 1 ? TRUE : FALSE;
		}
	}
?>